﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;


namespace UcAsp.Net.ModelCreate
{
    
    public class DataBase : IDisposable
    {
       
        private System.Data.SqlClient.SqlConnection Conn;
        public DataBase(string connection)
        {
            try
            {

                
                this.Conn = new System.Data.SqlClient.SqlConnection(connection);
                this.Conn.Open();
            }
            catch
            {
                
            }
        }
        public SqlDataReader ExecuteReader(string CommandTxt)
        {
            SqlCommand comm = new SqlCommand(CommandTxt, this.Conn);
            comm.CommandType = CommandType.Text;
            return comm.ExecuteReader();
        }
        public void Dispose()
        {
            this.Dispose(true);
        }
        protected void Dispose(bool Diposing)
        {
            try
            {
                this.Conn.Close();
                this.Conn.Dispose();
            }
            catch
            {
            }
            GC.Collect();
        }
    }
}
